import DictionaryConstants from "@/const/DictionaryConstants.ts";
import instance from "@/api/request.ts";
import { ProductSearchDto } from "@/model/SearchModel.ts";

const ApiConst = DictionaryConstants.ApiConst;

/**
 * 检索商品
 */
export function searchProducts(params: ProductSearchDto) {
    return instance.post(`${ApiConst.SEARCH}/es/search/product`, params, {});
}

/**
 * 根据skuId查询商品详情
 * @param skuId 商品skuId
 */
export function getSkuInfoById(skuId: number) {
    return instance.get(`${ApiConst.PRODUCT}/sku-info/item-info`, {
        params: {
            skuId,
        },
    });
}